<?php
	include "includes".DIRECTORY_SEPARATOR."start_session.php";
	
	
	if ( !defined('USERNAME') || !defined('GROUP') || GROUP != "comisie")
	{
		header("Location: manage_login.php");
		exit;
	}
	

	include "includes".DIRECTORY_SEPARATOR."header.php";
	main_header(1);
	
	//include second header

	include "includes".DIRECTORY_SEPARATOR."include_user_secondary_header.php";
	second_header( 3 );
	
	function findDataPost( $var_cui_furnizor, $var_nume_furnizor, $dbc )
	{
		if ( empty($var_cui_furnizor) and empty($var_nume_furnizor))
		{
			return;	
		}
		
		if( ! empty($var_cui_furnizor) )
		{
			$var_cui_furnizor = trim($var_cui_furnizor);
		}
		
		if( ! empty($var_nume_furnizor) )
		{
			$var_nume_furnizor = trim($var_nume_furnizor);
		}
		
		if ( empty($var_cui_furnizor) and empty($var_nume_furnizor))
		{
			echo "<tbody>";			
				echo "<tr>";						
					echo "<td>";
						echo "Introduceti o valoare in una din casutele de mai sus, in functie de criteriul de cautare !!!";
					echo "</td>";	
				echo "</tr>";
			echo "</tbody>";	
			return;
		}
		
		if ( (!empty($var_nume_furnizor)) and (strlen($var_nume_furnizor) < 3) )
		{
			echo "<tbody>";			
				echo "<tr>";						
					echo "<td>";
						echo "Cautarea dupa numele furnizorului se poate face introducand minimum 3 caractere !!!";
					echo "</td>";	
				echo "</tr>";
			echo "</tbody>";	
			return;
		}
		
		$query_furnizor = NULL;
		if ( ! empty($var_cui_furnizor) ) 
		{
			$query_furnizor = mysqli_query($dbc, "SELECT `nume`,`CUI_CF`,`numar_decizie_autorizare`,`judet`,`localitate`,`telefon` FROM anc.furnizor WHERE `CUI_CF` like '$var_cui_furnizor'");
		}
		else if ( ! empty($var_nume_furnizor) ) 
				{
			$query_furnizor = mysqli_query($dbc, "SELECT `nume`,`CUI_CF`,`numar_decizie_autorizare`,`judet`,`localitate`,`telefon` FROM anc.furnizor WHERE `nume` like '%$var_nume_furnizor%'");
		}

		if ( $query_furnizor )
				{
					
					$local_table_header = "";
					
					$local_table_header.="<thead>";
					$local_table_header.="<tr>";
										
						$local_table_header.="<th scope=\"col\" width=\"25%\">";
							$local_table_header.="<a href=\" 
							.php?cui_furnizor=".$var_cui_furnizor."\"><font color=\"#0000FF\"><h3>Nume</h3></font></a>";				
						$local_table_header.="</th>";
						
						$local_table_header.="<th scope=\"col\">";
							$local_table_header.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><font color=\"#0000FF\"><h3>CUI / CF</h3></font></a>";		
						$local_table_header.="</th>";
						
						$local_table_header.="<th scope=\"col\">";
							$local_table_header.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><font color=\"#0000FF\"><h3>Nr. Decizie</h3></font></a>";		
						$local_table_header.="</th>";
						
						$local_table_header.="<th scope=\"col\">";
							$local_table_header.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><font color=\"#0000FF\"><h3>Judet</h3></font></a>";		
						$local_table_header.="</th>";
						
						$local_table_header.="<th scope=\"col\">";
							$local_table_header.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><font color=\"#0000FF\"><h3>Localitate</h3></font></a>";		
						$local_table_header.="</th>";
						
						$local_table_header.="<th scope=\"col\">";
							$local_table_header.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><font color=\"#0000FF\"><h3>Telefon</h3></font></a>";		
						$local_table_header.="</th>";
						
	
			
					$local_table_header.="</tr>";
					$local_table_header.="</thead>";
					
					
					$local_table_content = "";
					$local_table_content.="<tbody>";
					
					$results_furnizor_by_cui_counter = 0;					
					while ($results_furnizor_by_cui = mysqli_fetch_assoc($query_furnizor))
					{ 
						$results_furnizor_by_cui_counter++;
						$local_table_content.="<tr>";						
							$local_table_content.="<td>";
								$local_table_content.=$results_furnizor_by_cui['nume'];
							$local_table_content.="</td>";	
							$local_table_content.="<td>";
								$local_table_content.=$results_furnizor_by_cui['CUI_CF'];
							$local_table_content.="</td>";
							
							$local_table_content.="<td>";
								$local_table_content.=$results_furnizor_by_cui['numar_decizie_autorizare'];
							$local_table_content.="</td>";
							
							$local_table_content.="<td>";
								$local_table_content.=$results_furnizor_by_cui['judet'];
							$local_table_content.="</td>";
							
							$local_table_content.="<td>";
								$local_table_content.=$results_furnizor_by_cui['localitate'];
							$local_table_content.="</td>";	
							
							$local_table_content.="<td>";
								$local_table_content.=$results_furnizor_by_cui['telefon'];
							$local_table_content.="</td>";
							
							$local_table_content.="<td>";
								$local_table_content.="<a href=\"user_commission_search.php?cui_furnizor=".$results_furnizor_by_cui['CUI_CF']."&edit_furnizor=true\">Modificare furnizor</a>";
							$local_table_content.="</td>";
							
							$local_table_content.="<td>";
								$local_table_content.="<a href=\"user_commission_search.php?cui_furnizor=".$results_furnizor_by_cui['CUI_CF']."\">Listare programe</a>";
							$local_table_content.="</td>";
							
							$local_table_content.="<td>";
								$local_table_content.="<a href=\"user_commission_search.php?cui_furnizor=".$results_furnizor_by_cui['CUI_CF']."&add_program=true\">Adaugare program</a>";
							$local_table_content.="</td>";	
							
								
							$local_table_content.="</tr>";
					}
					$local_table_content.="</tbody>";
					
					if( 0 == $results_furnizor_by_cui_counter )
					{
						echo "<tbody>";
						echo "<tr>";
							echo "<td>";
								echo "Nu au fost gasite in baza de date inregistrari care sa corespunda criteriilor dumneavoastra de selectie !";
							echo "</td>";
						echo "</tr>";
						echo "<tr>";
							echo "<td>";
								echo "Va rugam reincercati !";
							echo "</td>";
						echo "</tr>";
						echo "</tbody>";
					}
					else
					{
						# Print results if anything it is found	
						echo $local_table_header;
						echo $local_table_content;
					}		
				}
	}
	
	function findDataGet( $var_cui_furnizor, $var_id_program, $var_id_sesiune, $blist_furnizor, $dbc )
	{
		if ( empty($var_cui_furnizor) )
		{
			return;	
		}
		
		if( !empty($blist_furnizor) )
		{
			findDataPost( $var_cui_furnizor, "", $dbc);
			return;
		}
				
		if ( empty($var_id_program) and empty($var_id_sesiune) )
		{
			echo "<h3>CUI/CF Furnizor: $var_cui_furnizor</h3>";
			echo "<h4>Lista programe: </h4>";
			
			$local_table_header = "";
			$results_list_programs_counter = 0;	
			
			echo "<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."&blist_furnizor=true\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
			
			$query_programe_by_cui_furnizor = mysqli_query($dbc, "SELECT `CUI_CF`,`nume_program`, `id_furnizori_programe`,`cod`, `stare_program`,`serie_autorizatie`,`nr_autorizatie_program`,`data_autorizatie_program` FROM anc.furnizori_programe WHERE `CUI_CF`='$var_cui_furnizor'");
			if ( $query_programe_by_cui_furnizor )
			{
				$local_table_header.="<thead>";
				$local_table_header.="<tr>";
									
					$local_table_header.="<th scope=\"col\" width=\"25%\">";
						$local_table_header.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><font color=\"#0000FF\"><h3>Nume Program</h3></font></a>";				
					$local_table_header.="</th>";
					
					$local_table_header.="<th scope=\"col\">";
						$local_table_header.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><font color=\"#0000FF\"><h3>Cod COR/Nomenclator</h3></font></a>";		
					$local_table_header.="</th>";

					$local_table_header.="<th scope=\"col\">";
						$local_table_header.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><font color=\"#0000FF\"><h3>Starea programului</h3></font></a>";		
					$local_table_header.="</th>";
					
		
				$local_table_header.="</tr>";
				$local_table_header.="</thead>";
				
				$local_table_content = "";
				$local_table_content.="<tbody>";
				
				
				while ($results_programe = mysqli_fetch_assoc($query_programe_by_cui_furnizor))
				{ 
					$results_list_programs_counter++;
					$local_table_content.="<tr>";						
						$local_table_content.="<td>";
							$local_table_content.=$results_programe['nume_program'];
						$local_table_content.="</td>";	
						$local_table_content.="<td>";
							$local_table_content.=$results_programe['cod'];
						$local_table_content.="</td>";
						$local_table_content.="<td>";
							$local_table_content.=$results_programe['stare_program'];
						$local_table_content.="</td>";
						$local_table_content.="<td>";
							$local_table_content.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."&id_program=".$results_programe['id_furnizori_programe']."&edit_program=true\">Modificare program</a>";
						$local_table_content.="</td>";
						
						$local_table_content.="<td>";
							$local_table_content.="<a href=\"user_commission_search.php?cui_furnizor=".$results_programe['CUI_CF']."&id_program=".$results_programe['id_furnizori_programe']."\">Listare sesiuni</a>";
						$local_table_content.="</td>";
						
						$local_table_content.="<td>";
							$local_table_content.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."&add_program=true\">Adaugare program</a>";
						$local_table_content.="</td>";	
						
						$local_table_content.="<td>";
							$local_table_content.="<a href=\"user_commission_search.php?cui_furnizor=".$results_programe['CUI_CF']."&id_program=".$results_programe['id_furnizori_programe']."&retire_program=true\">Retragere program</a>";
						$local_table_content.="</td>";	
						$local_table_content.="</tr>";
				}
				
				$local_table_content.="</tbody>";	
				
				
				if( 0 == $results_list_programs_counter )
				{
					echo "<tbody>";
					echo "<tr>";
						echo "<td>";
							echo "Nu exista programe inregistrate pentru acest furnizor!";
						echo "</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<td>";
							echo "<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."&add_program=true\">Adaugare program</a>";
						echo "</td>";
					echo "</tr>";
					echo "</tbody>";
				}
				else
				{
					# Print results if anything it is found	
					echo $local_table_header;
					echo $local_table_content;
				}	
			}
		}
		else if ( ! empty($var_id_program) and empty($var_id_sesiune) )
		{
			
			echo "<h3>CUI/CF Furnizor: $var_cui_furnizor | Program: $var_id_program</h3>";		
			echo "<h4>Lista sesiuni: </h4>";
			
			$local_table_header = "";
			$results_list_sessions_counter = 0;
			
			$query_programe_by_id_program = mysqli_query($dbc, "SELECT `id_sesiune`,`id_furnizori_programe`,`data_sesiunii`,`nr_persoane_inscrise`,`nr_persoane_finalizat` FROM anc.sesiuni WHERE `id_furnizori_programe`='$var_id_program'");

			echo "<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
			
			if ( $query_programe_by_id_program )
			{
				
				$local_table_header.="<thead>";
				$local_table_header.="<tr>";
									
					$local_table_header.="<th scope=\"col\">";
						$local_table_header.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><font color=\"#0000FF\"><h3>Data Sesiune</h3></font></a>";		
					$local_table_header.="</th>";
					
					$local_table_header.="<th scope=\"col\">";
						$local_table_header.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><font color=\"#0000FF\"><h3>Nr. Persoane Inscrise</h3></font></a>";		
					$local_table_header.="</th>";
					
					$local_table_header.="<th scope=\"col\">";
						$local_table_header.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><font color=\"#0000FF\"><h3>Nr. Persoane Finalizat</h3></font></a>";		
					$local_table_header.="</th>";
		
				$local_table_header.="</tr>";
				$local_table_header.="</thead>";
				
				
				$local_table_content = "";
				$local_table_content.="<tbody>";
				
				while ($results_sesiuni = mysqli_fetch_assoc($query_programe_by_id_program))
				{ 
					$results_list_sessions_counter++;
					$local_table_content.="<tr>";						
						$local_table_content.="<td>";
							$local_table_content.=$results_sesiuni['data_sesiunii'];
						$local_table_content.="</td>";	
						$local_table_content.="<td>";
							$local_table_content.=$results_sesiuni['nr_persoane_inscrise'];
						$local_table_content.="</td>";
						
						$local_table_content.="<td>";
							$local_table_content.=$results_sesiuni['nr_persoane_finalizat'];
						$local_table_content.="</td>";
						
						$local_table_content.="<td>";
							$local_table_content.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."&id_program=".$var_id_program."&id_sesiune=".$results_sesiuni['id_sesiune']."&edit_sesiune=true\">Modificare sesiune</a>";
						$local_table_content.="</td>";
						
						$local_table_content.="<td>";						
							$local_table_content.="<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."&id_program=".$var_id_program."&add_sesiune=true\">Adaugare sesiune</a>";
						$local_table_content.="</td>";		
						$local_table_content.="</tr>";
				}
				
				$local_table_content.="</tbody>";	
				
				if( 0 == $results_list_sessions_counter )
				{
					echo "<tbody>";
						echo "<td>";
							echo "Nu exista programe inregistrate pentru acest program";
						echo "</td>";
					echo "</tr>";
					echo "<tr>";
						echo "<td>";
							echo "<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."&id_program=".$var_id_program."&add_sesiune=true\">Adaugare sesiune</a>";
						echo "</td>";
					echo "</tr>";
					echo "</tbody>";
				}
				else
				{
					# Print results if anything it is found	
					echo $local_table_header;
					echo $local_table_content;
				}	
				
			}
		}
		
	}
	
?>
         <tr>
			<td width="400px" align="left" valign="top">
               	<form id="searchbox" method="post" action = "user_commission_search.php">
				    <input id="search" type="text" name="cui_furnizor" placeholder="Cauta CUI/CF">
				    <input id="submit" type="submit" value="Cauta">
				</form>
        	</td>
            
            <td width="400px" align="left" valign="top">
               	<form id="searchbox" method="post" action = "user_commission_search.php">
				    <input id="search" type="text" name="nume_furnizor" placeholder="Cauta nume furnizor">
				    <input id="submit" type="submit" value="Cauta">
				</form>
        	</td>
		</tr> 

        

    

<?php 

	/* 	 EDIT MANUFACTURER */

   if($_SERVER['REQUEST_METHOD'] == "GET" and isset($_GET['edit_furnizor']) and isset($_GET['cui_furnizor']))
   {
	   	echo "<tr>";
			echo "<td style=\"padding-left:30;padding-right:20;padding-bottom:20\" valign=\"top\" background=\"images/white.jpg\" width=\"800\" height=\"400\">";
			echo "<a href=\"user_commission_search.php?cui_furnizor=".$_GET['cui_furnizor']."&blist_furnizor=true\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
			echo "<h3>CUI/CF Furnizor: $_GET[cui_furnizor]</h3>";
			echo "<h4>Modificare date furnizor: </h4>";
	    	include "includes".DIRECTORY_SEPARATOR."include_user_manufacturer.php";
        	echo "</td>";       
        echo "</tr>";
   }
   else if($_SERVER['REQUEST_METHOD'] == "POST" and isset($_POST['edit_furnizor']) and isset($_POST['cui_furnizor']))
   {
	   	echo "<tr>";
			echo "<td style=\"padding-left:30;padding-right:20;padding-bottom:20\" valign=\"top\" background=\"images/white.jpg\" width=\"800\" height=\"400\">";
			echo "<a href=\"user_commission_search.php?cui_furnizor=".$_POST['cui_furnizor']."&blist_furnizor=true\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
			echo "<h3>CUI/CF Furnizor: $_POST[cui_furnizor]</h3>";
			echo "<h4>Modificare date furnizor: </h4>";
	    	include "includes".DIRECTORY_SEPARATOR."include_user_manufacturer.php";
        	echo "</td>";       
        echo "</tr>";
   }
   /* 	 ADD NEW PROGRAM */

   else if($_SERVER['REQUEST_METHOD'] == "GET" and isset($_GET['add_program']) and isset($_GET['cui_furnizor'] ))
   {
		echo "<tr>";
			
    		echo "<td style=\"padding-left:30;padding-right:20;padding-bottom:20\" valign=\"top\" background=\"images/white.jpg\" width=\"800\" height=\"400\">";
				echo "<a href=\"user_commission_search.php?cui_furnizor=". $_GET['cui_furnizor']."\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
				echo "<h3>CUI/CF Furnizor: $_GET[cui_furnizor]</h3>";
				echo "<h4>Adaugare program: </h4>";
				include "includes".DIRECTORY_SEPARATOR."include_user_program.php";
        	echo "</td>";       
        echo "</tr>";
   }
   
   else if($_SERVER['REQUEST_METHOD'] == "POST" and isset($_POST['add_program']) and isset($_POST['cui_furnizor'] ))
   {
		echo "<tr>";
			
    		echo "<td style=\"padding-left:30;padding-right:20;padding-bottom:20\" valign=\"top\" background=\"images/white.jpg\" width=\"800\" height=\"400\">";
				echo "<a href=\"user_commission_search.php?cui_furnizor=". $_POST['cui_furnizor']."\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
				echo "<h3>CUI/CF Furnizor: $_POST[cui_furnizor]</h3>";
				echo "<h4>Adaugare program: </h4>";
				include "includes".DIRECTORY_SEPARATOR."include_user_program.php";
        	echo "</td>";       
        echo "</tr>";
   }
   
    /* 	 REJECT PROGRAM */

    /* 	 RETIRE PROGRAM */

   else  if( $_SERVER['REQUEST_METHOD'] == "GET"   and isset($_GET['retire_program']) and isset($_GET['cui_furnizor'] ) and isset($_GET['id_program']))
   {
		$var_cui_furnizor = $_GET['cui_furnizor'];
		$id_furnizori_programe = $_GET['id_program'];
		echo "<tr>";
    		echo "<td style=\"padding-left:30;padding-right:20;padding-bottom:20\" valign=\"top\" background=\"images/white.jpg\" width=\"800\" height=\"400\">";
				echo "<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
				echo "<h3>CUI/CF Furnizor: $var_cui_furnizor</h3>";
				echo "<h4>Retragere program: </h4>";
				include "includes".DIRECTORY_SEPARATOR."committee_retire_program.php";
        	echo "</td>";       
        echo "</tr>";
   }
   else if($_SERVER['REQUEST_METHOD'] == "POST" and isset($_POST['save_retire_program'])){
	   //validate the retire form
	
		$var_cui_furnizor = $_POST['cui_furnizor'];
		$id_furnizori_programe = $_POST['id_furnizori_programe'];
		echo "<tr>";
    		echo "<td style=\"padding-left:30;padding-right:20;padding-bottom:20\" valign=\"top\" background=\"images/white.jpg\" width=\"800\" height=\"400\">";
				echo "<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
				echo "<h3>CUI/CF Furnizor: $var_cui_furnizor</h3>";
				echo "<h4>Retragere program: </h4>";
				include "includes".DIRECTORY_SEPARATOR."committee_retire_program.php";
        	echo "</td>";       
        echo "</tr>";   	
   }
  
   
   /* EDIT PROGRAM */

   else  if($_SERVER['REQUEST_METHOD'] == "GET" and isset($_GET['edit_program']) and isset($_GET['cui_furnizor']) and isset($_GET['id_program']))
   {
		echo "<tr>";
		echo "<td style=\"padding-left:30;padding-right:20;padding-bottom:20\" valign=\"top\" background=\"images/white.jpg\" width=\"800\" height=\"400\">";
	    	echo "<a href=\"user_commission_search.php?cui_furnizor=".$_GET['cui_furnizor']."\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
			echo "<h3>CUI/CF Furnizor: $_GET[cui_furnizor] | Program: $_GET[id_program] </h3>";
			echo "<h4>Modifica program: </h4>";
	    	include "includes".DIRECTORY_SEPARATOR."include_user_program.php";
        	echo "</td>";       
        echo "</tr>";
   }
   else  if($_SERVER['REQUEST_METHOD'] == "POST" and isset($_POST['edit_program']) and isset($_POST['cui_furnizor']) and isset($_POST['id_program']))
   {
		echo "<tr>";
		echo "<td style=\"padding-left:30;padding-right:20;padding-bottom:20\" valign=\"top\" background=\"images/white.jpg\" width=\"800\" height=\"400\">";
			echo "<a href=\"user_commission_search.php?cui_furnizor=".$_POST['cui_furnizor']."\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
			echo "<h3>CUI/CF Furnizor: $_POST[cui_furnizor] | Program: $_POST[id_program] </h3>";
			echo "<h4>Modifica program: </h4>";
	    	include "includes".DIRECTORY_SEPARATOR."include_user_program.php";
        	echo "</td>";       
        echo "</tr>";
   }
   
   /* ADD SESSION */
   
   else  if($_SERVER['REQUEST_METHOD'] == "GET" and isset($_GET['add_sesiune']) and isset($_GET['cui_furnizor']) and isset($_GET['id_program']))
   {
		echo "<tr>";
		echo "<td style=\"padding-left:30;padding-right:20;padding-bottom:20\" valign=\"top\" background=\"images/white.jpg\" width=\"800\" height=\"400\">";
	    	echo "<a href=\"user_commission_search.php?cui_furnizor=".$_GET['cui_furnizor']."&id_program=".$_GET['id_program']."\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
			echo "<h3>CUI/CF Furnizor: $_GET[cui_furnizor] | Program: $_GET[id_program] </h3>";
			echo "<h4>Adaugare sesiune: </h4>";
	    	include "includes".DIRECTORY_SEPARATOR."include_user_session.php";
        	echo "</td>";       
        echo "</tr>";
   }
   else  if($_SERVER['REQUEST_METHOD'] == "POST" and isset($_POST['add_sesiune']) and isset($_POST['cui_furnizor']) and isset($_POST['id_program']))
   {
		echo "<tr>";
		echo "<td style=\"padding-left:30;padding-right:20;padding-bottom:20\" valign=\"top\" background=\"images/white.jpg\" width=\"800\" height=\"400\">";
	    	echo "<a href=\"user_commission_search.php?cui_furnizor=".$_POST['cui_furnizor']."&id_program=".$_POST['id_program']."\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
			echo "<h3>CUI/CF Furnizor: $_POST[cui_furnizor] | Program: $_POST[id_program] </h3>";
			echo "<h4>Adaugare sesiune: </h4>";
	    	include "includes".DIRECTORY_SEPARATOR."include_user_session.php";
        	echo "</td>";       
        echo "</tr>";
   }
   
   /* EDIT SESSION */
   
   else  if($_SERVER['REQUEST_METHOD'] == "GET" and isset($_GET['edit_sesiune']) and isset($_GET['cui_furnizor']) and isset($_GET['id_program']) and isset($_GET['id_sesiune']))
   {
		echo "<tr>";
		echo "<td style=\"padding-left:30;padding-right:20;padding-bottom:20\" valign=\"top\" background=\"images/white.jpg\" width=\"800\" height=\"400\">";
	    	echo "<a href=\"user_commission_search.php?cui_furnizor=".$_GET['cui_furnizor']."&id_program=".$_GET['id_program']."\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
			echo "<h3>CUI/CF Furnizor: $_GET[cui_furnizor] | Program: $_GET[id_program] </h3>";
			echo "<h4>Modificare date sesiune: </h4>";
	    	include "includes".DIRECTORY_SEPARATOR."include_user_session.php";
        	echo "</td>";       
        echo "</tr>";
   }
   else  if($_SERVER['REQUEST_METHOD'] == "POST" and isset($_POST['edit_sesiune']) and isset($_POST['cui_furnizor']) and isset($_POST['id_program']) and isset($_POST['id_sesiune']))
   {
		echo "<tr>";
		echo "<td style=\"padding-left:30;padding-right:20;padding-bottom:20\" valign=\"top\" background=\"images/white.jpg\" width=\"800\" height=\"400\">";
	    	echo "<a href=\"user_commission_search.php?cui_furnizor=".$_POST['cui_furnizor']."&id_program=".$_POST['id_program']."\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
			echo "<h3>CUI/CF Furnizor: $_POST[cui_furnizor] | Program: $_POST[id_program] </h3>";
			echo "<h4>Modificare date sesiune: </h4>";
	    	include "includes".DIRECTORY_SEPARATOR."include_user_session.php";
        	echo "</td>";       
        echo "</tr>";
   }
   
      else if($_SERVER['REQUEST_METHOD'] == "POST" and isset($_POST['save_retire_program'])){
	   //validate the retire form
	
		$var_cui_furnizor = $_POST['cui_furnizor'];
		$id_furnizori_programe = $_POST['id_furnizori_programe'];
		echo "<tr>";
    		echo "<td style=\"padding-left:30;padding-right:20;padding-bottom:20\" valign=\"top\" background=\"images/white.jpg\" width=\"800\" height=\"400\">";
				echo "<a href=\"user_commission_search.php?cui_furnizor=".$var_cui_furnizor."\"><img src=\"images/back_icon.png\" alt=\"ANC\"/></a>";
				echo "<h3>CUI/CF Furnizor: $var_cui_furnizor</h3>";
				echo "<h4>Retragere program: </h4>";
				include "includes".DIRECTORY_SEPARATOR."committee_retire_program.php";
        	echo "</td>";       
        echo "</tr>";   	
   }
   
   else
   {
           echo "<tr>";
    			echo "<td  colspan=\"2\" style=\"padding-left:30;padding-right:20;\" valign=\"top\" background=\"images/white.jpg\" width=\"800\" height=\"400\">";
                    echo "<table class=\"zebra-style\">";
							if($_SERVER['REQUEST_METHOD'] == "POST")
							{
				findDataPost( ( empty($_POST['cui_furnizor'] ) ? "": $_POST['cui_furnizor'] ), ( empty($_POST["nume_furnizor"]) ? "" : $_POST["nume_furnizor"] ),$dbc);												
							}
							
							if($_SERVER['REQUEST_METHOD'] == 'GET')
							{								
				findDataGet( ( empty($_GET['cui_furnizor'] ) ? "": $_GET['cui_furnizor'] ), ( empty($_GET['id_program']) ? "" : $_GET['id_program'] ), ( empty($_GET['id_sesiune']) ? "" : $_GET['id_sesiune'] ) , ( empty($_GET['blist_furnizor'] ) ? "": $_GET['blist_furnizor'] ), $dbc);		
							}		
                    echo "</table>";
                
             echo "</td>";       
           echo "</tr>";
   }

	include "includes".DIRECTORY_SEPARATOR."footer.php";
?>
